package aishua.com.mytestapplist.extend;


import android.util.Xml;

import aishua.com.mytestapplist.utils.LogUtils;

/**
 * Created by aishua on 2017/5/10.
 */

public class Grandfather extends GradGradF {
    private static final String TAG = "Grandfather";

    public void testthond() {

        System.out.println("woshiyeye");
    }

    int i = 0;
    boolean result = false;

    @Override
    public boolean  testdigui() {
//        i++;
        int i = LogUtils.geti();
        final GradGradF grandfather = getGradGradF(i);

        if (i == 1 || i == 2 || i == 3) {

            if (grandfather.testdigui()) {

                System.out.println("name---->" + grandfather.getClass().getName());
                result = true;
                return result;
            }
        }
        if (i == 4) {

            return super.testdigui();
        }
        if (i==5||i==6){

            if (grandfather.testdigui()){

                System.out.println("name---->" + grandfather.getClass().getName()+"i--->"+i);
                result = true;
                return result;
            }
        }
        return result;
    }

    private GradGradF grandfather;

    public GradGradF getGradGradF(int i) {

        if (i == 3) {
            grandfather = new Child();
        }
        if (i == 2) {

            grandfather = new Partent();
        }
        if (i == 1) {

            grandfather = new Grandfather();
        }
        return grandfather;
    }

    public void testdigui2(){

        testdigui();
    }

    public int  geti(){

       return i =i+1;

    }
}
